export default {
    props: {
        value: {type: [String], default: ''},
        type: {type: String, default: 'date'},
        args: {type: [Array, null], default: null},
    },
    data() {
        return {
            val: ''
        }
    },
    render(h) {
        const obj = {};
        if(this.args) {
            this.args.forEach(t => {                
                if(t.arg == 'format') {
                    obj.format = t.value;
                    obj['value-format'] = t.value;
                }
            })
        }
        return h('el-date-picker', {
            attrs: {
                type: 'datetime', 
                placeholder: '请选择日期',
                'value-format': 'yyyy-MM-dd HH:mm:ss',
                value: this.val,
                ...obj
            },
            on: {
                input: (e) => {
                    this.val = e;
                    this.$emit('input', e)
                }
            }
        }, '测试')
    }
}